﻿using System;
using System.ComponentModel.Composition;
using NUnit.Framework;

namespace CommonContainer.UnitTest
{
    public static class TestUtility
    {
        public static void AssertMefExport<TExportedType, TContractType>()
        {
            Type exportedType = typeof (TExportedType);

           var attributes = exportedType.GetCustomAttributes(typeof (ExportAttribute), false);

            Assert.That(attributes.Length, Is.EqualTo(1));
            var exportAttribute = (ExportAttribute) attributes[0];

            Assert.That(exportAttribute.ContractType, Is.EqualTo(typeof (TContractType))); 
        }

    }
}
